<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import = "java.util.*" %>
    
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="de">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>List Libraries</title>
    </head>
    <body>
        <h1>Libraries</h1>
        <a href="<%= request.getContextPath() %>/library?elib_action=CREATE">Add Library</a>
        
        <div>
	        <table>
	            <tr>
	                <th>ID</th>
	                <th>Kategorie</th>
	                <th>Name</th>
	                <th>Beschreibung</th>
	                <th></th>
	            </tr>
	            <c:forEach items="${libraries}" var="library">
	                <tr>
	                    <td>${library.id}</td>
	                    <td><fmt:formatNumber value="${library.numericKey}" type="NUMBER" /></td>
	                    <td><c:out value="${library.name}" /></td>
	                    <td><c:out value="${library.description}" /></td>
	                    <td>
	                    	<a href="library?elib_action=READ&id=<c:out value="${library.id}" />">edit</a>
	                    	<a href="library?elib_action=DELETE&id=<c:out value="${library.id}" />">delete</a>
	                    </td>
	                </tr>
	            </c:forEach>
	       </table>
       </div>
		
		<b>Parameters:</b><br>
<%
  Enumeration parameterList = request.getParameterNames();
  while( parameterList.hasMoreElements() )
  {
    String   sName     = parameterList.nextElement().toString();
    String[] sMultiple = request.getParameterValues( sName );
    if( 1 >= sMultiple.length )
      out.println( sName + " = " + request.getParameter( sName ) + "<br>" );
    else
      for( int i=0; i<sMultiple.length; i++ )
        out.println( sName + "[" + i + "] = " + sMultiple[i] + "<br>" );
  }
%>

	<div id="footer">
		footer<br/>
		JSP Path: <%= request.getServletPath() %><br/>
		<!-- RequestURI: <%= request.getRequestURI() %><br/>
		ContextPath: <%= request.getContextPath() %><br/>
		ServletPath: <%= request.getServletPath() %><br/>
		PathInfo: <%= request.getPathInfo() %><br/>
		QueryString: <%= request.getQueryString() %> -->
	</div>
    </body>
</html>